const CracoLessPlugin = require('craco-less');
const px2rem = require("postcss-px2rem-exclude");

module.exports = {
    plugins: [
        {
            plugin: CracoLessPlugin,
            options: {
                lessLoaderOptions: {
                    lessOptions: {
                        modifyVars: { '@primary-color': '#1DA57A' },
                        javascriptEnabled: true,
                    },
                },
            },
        },
    ],

    //针对 less 文件的按需载入
    babel: {
        plugins: [
            ["import", { libraryName: 'antd', style: true }]
        ]
    },
    //进行 css 适配
    style:{
        postcss:{
            plugins:[
                px2rem({
                    //
                    remUnit: 375 / 10, // 375 为设计稿的宽度
                    exclude: /node-modules/i
                })
            ]
        }
    },
};